package application.translators.impl;

import application.model.ProducentModel;
import application.model.ProducentsModel;
import application.translators.Translator;
import mappings.Producent;

import java.util.List;

public class ProducentsTranslator implements Translator<List<Producent>, ProducentsModel>
{
    @Override
    public ProducentsModel translate(List<Producent> inputProducents)
    {
        ProducentsModel outputProducents = new ProducentsModel();

        for(Producent producent : inputProducents)
        {
            ProducentModel producentModel = new ProducentModel();

            producentModel.setId(producent.getId());
            producentModel.setName(producent.getName());

            outputProducents.addProducent(producentModel);
        }

        return outputProducents;
    }
}
